#define _CRT_SECURE_NO_WARNINGS
#include "1.18_hs.h"
int calc(int n)
{
	int b = 0;
	for (int i = 2; i <= n; i++)
	{
		if (n % i == 0)
			b = b + n / i;
	}
	return b;
}

int qmsd(int a)
{
	int b = calc(a);
	if (calc(b) == a && b > a)
		return b;
	else
		return 0;
}